package com.demo.reader_;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOError;
import java.io.IOException;

/**
 * @author gy
 * @date 2022/4/5
 */
public class BufferedReader01 {
    public static void main(String[] args) throws IOException {


        String fileName = "f:\\20220403\\fileReader.txt";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
        String lineContext;
        while ((lineContext = bufferedReader.readLine()) != null){
            System.out.println(lineContext);
        }
        // 最后一定要关闭流，底层调用的是  FileReader.close()
        bufferedReader.close();
    }
}
